<!-- pages/index/index.vue -->
<template>
	<view class="content">
		<MySearch @onClick="onClickSearch"></MySearch>
		<MySwiper height="400rpx" :swiperList="swiperList" keyName="image_url" @onClick="onClickSwiperItem"></MySwiper>
	</view>
</template>

<script>
	import request from '../../request/request.js'
	import {
		apiIndex
	} from '../../request/api.js'

	export default {
		data() {
			return {
				swiperList: []
			}
		},
		created() {
			request({
				url: apiIndex,
				successCb: res => {
					this.swiperList = res.banner
				}
			})
		},
		methods: {
			onClickSearch() {
				uni.navigateTo({
					url: '../historyAndHot/historyAndHot'
				})
			},
			onClickSwiperItem(index) {
				console.log(this.swiperList[index].id)
			}
		}
	}
</script>
